package com.cys.mybatis.executor.statement;

import com.cys.mybatis.mapping.BoundSql;
import com.cys.mybatis.session.ResultHandler;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;

/**
 * @Author: cys
 * @description:语句处理器
 * @CreateTime: 2024-10-27  15:32
 * @Version: 1.0
 */
public interface StatementHandler {

    /** 准备语句 */
    Statement prepare(Connection connection) throws SQLException;

    /** 参数化， 给 Statement设置参数 */
    void parameterize(Statement statement) throws SQLException;

    /** 执行更新 */
    int update(Statement statement) throws SQLException;

    /** 执行查询 */
    <E>List<E> query(Statement statement, ResultHandler resultHandler) throws SQLException;

    /** 获取绑定SQL */
    BoundSql getBoundSql();
}
